﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Popup.Master" CodeBehind="DocumentList.aspx.cs"
    Inherits="VSM.Parts.DocumentList" EnableEventValidation="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function CheckAll(oCheckbox) {
            var GridView2 = document.getElementById("<%=grdBP.ClientID %>");
            for (i = 1; i < GridView2.rows.length; i++) {
                GridView2.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = oCheckbox.checked;
            }
        }
    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:HiddenField ID="hdnDocType" runat="server" />
                <asp:HiddenField ID="hdnPayNoDoc" runat="server" />
                 <asp:HiddenField ID="hdnDepartment" runat="server" />
                <div style="height: 525px; overflow: scroll">
                    <table id="Table1" width="100%" style="font-weight: bold" >
                        <tr>
                            <td class="FormLineItemAlt" style="width: 7%;">
                                From Doc. No.</td>
                            <td class="FormLineItemAlt" style="white-space: nowrap; width: 18%;" valign="middle">
                                <asp:TextBox ID="txtFromDocNo" OnKeyPress="return isNumberKey(this, event);" runat="server"></asp:TextBox>
                            </td>
                            <td class="FormLineItemAlt" style="width: 7%;">
                                To Doc. No.</td>
                            <td class="FormLineItemAlt" style="white-space: nowrap; width: 18%;" valign="middle">
                                <asp:TextBox ID="txtToDocNo" OnKeyPress="return isNumberKey(this, event);" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItem" style="width: 100px;">
                                Customer</td>
                            <td class="FormLineItem" valign="middle">
                                <asp:DropDownList ID="ddlCustomer" runat="server">
                                </asp:DropDownList>
                            </td>
                            <td class="FormLineItem" valign="middle">
                                <asp:Label ID="lblStatus" runat="server" Text="Status"></asp:Label>
                            </td>
                            <td class="FormLineItem" valign="middle">
                                <asp:DropDownList ID="ddlStatus" runat="server" Enabled="False">
                                    <asp:ListItem></asp:ListItem>
                                    <asp:ListItem Value="O">Open</asp:ListItem>
                                    <asp:ListItem Value="C">Closed</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItemAlt" valign="middle">From Doc. Date</td>
                            <td class="FormLineItemAlt" valign="middle">
                                <asp:TextBox ID="txtFromDocDate" Width="100px" runat="server"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtFromDocDate_CalendarExtender" runat="server" 
                                    Format="dd/MM/yyyy" PopupButtonID="imgFromDocDate" 
                                    TargetControlID="txtFromDocDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgFromDocDate" runat="Server" AlternateText="Click to show calendar" ImageUrl="~/Images/Calendar_scheduleHS.png" />                            
                            </td>
                            <td class="FormLineItemAlt" valign="middle">To Doc. Date</td>
                            <td class="FormLineItemAlt" valign="middle">
                                <asp:TextBox ID="txtToDocDate" runat="server" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtToDocDate_CalendarExtender" runat="server" 
                                    Format="dd/MM/yyyy" PopupButtonID="imgToDocDate" 
                                    TargetControlID="txtToDocDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgToDocDate" runat="Server" 
                                    AlternateText="Click to show calendar" 
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItem" valign="middle">From Due Date</td>
                            <td class="FormLineItem" valign="middle">
                                <asp:TextBox ID="txtFromDueDate" runat="server" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtFromDueDate_CalendarExtender" runat="server" 
                                    Format="dd/MM/yyyy" PopupButtonID="imgFromDueDate" 
                                    TargetControlID="txtFromDueDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgFromDueDate" runat="Server" 
                                    AlternateText="Click to show calendar" 
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                            </td>
                            <td class="FormLineItem" valign="middle">To Due Date</td>
                            <td class="FormLineItem" valign="middle">
                                <asp:TextBox ID="txtToDueDate" runat="server" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtToDueDate_CalendarExtender" runat="server" 
                                    Format="dd/MM/yyyy" PopupButtonID="imgToDueDate" TargetControlID="txtToDueDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgToDueDate" runat="Server" 
                                    AlternateText="Click to show calendar" 
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItemAlt" valign="middle">From Doc. Total</td>
                            <td class="FormLineItemAlt" valign="middle">
                                <asp:TextBox ID="txtFromDocTotal" OnKeyPress="return isNumberKey(this, event);" 
                                   style="text-align:right;" runat="server"></asp:TextBox>
                            </td>
                            <td class="FormLineItemAlt" valign="middle">To Doc. Total</td>
                            <td class="FormLineItemAlt" valign="middle">
                                <asp:TextBox ID="txtToDocTotal" OnKeyPress="return isNumberKey(this, event);" 
                                    style="text-align:right;" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItem" valign="middle">Remark</td>
                            <td class="FormLineItem" valign="middle">
                                <asp:TextBox ID="txtRemark" Width="100%" runat="server" ></asp:TextBox>
                            </td>
                            <td class="FormLineItem" valign="middle" >
                                <asp:Button ID="btnFilterRemark" runat="server" OnClick="btnFiletrRemark_Click" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;margin-left:2px;" 
                                    Text="Filter" />
                            </td>
                            <td class="FormLineItem" valign="middle"><asp:DropDownList ID="ddlPOType" runat="server">
                               <asp:ListItem Value="-1">Select DO Type</asp:ListItem>
                                    <asp:ListItem Value="0">mO</asp:ListItem>
                                    <asp:ListItem Value="1">eO</asp:ListItem>
                                </asp:DropDownList>
                                &nbsp;</td>
                        </tr>
                        <tr>
                            <td class="FormLineItemAlt" valign="middle">
                                VSM SO Number</td>
                            <td class="FormLineItemAlt" valign="middle">
                                <asp:TextBox ID="txtVSMSONumber" runat="server" 
                                   ></asp:TextBox>
                            </td>
                            <td class="FormLineItemAlt" valign="middle">
                                Debit Note</td>
                            <td class="FormLineItemAlt" valign="middle">
                                <asp:TextBox ID="txtDebitNote" runat="server" 
                                   ></asp:TextBox>
                                <asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" 
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;" 
                                    Text="Search" />
                            </td>
                        </tr>
                    </table>
                    <table style="width: 100%; border: 1px;" cellpadding="3" cellspacing="0">
                        <tr>
                            <td colspan="2" style="text-align: center;">
                                <asp:GridView ID="grdBP" runat="server" CssClass="GridInner" Width="100%" BorderColor="White"
                                    BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                                    HeaderStyle-Height="27px" OnSorting="grdBP_Sorting" OnSelectedIndexChanged="grdBP_SelectedIndexChanged"
                                    OnRowDataBound="grdBP_RowDataBound">
                                    <RowStyle BackColor="#D9E0ED" ForeColor="Black" BorderColor="White" BorderWidth="2px"
                                        Height="25px" />
                                    <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" Height="25px" />
                                    <Columns>
                                     <asp:TemplateField>
                                            <ItemStyle HorizontalAlign="Center" Width="2%" />
                                            <HeaderTemplate>
                                                <asp:CheckBox ID="chkheader" runat="server" onclick="CheckAll(this)" />
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkChild" runat="server" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="No." SortExpression="DocNum">
                                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblDocNum" runat="server" Text='<%# Bind("DocNum") %>' BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Document Date" SortExpression="DocDate">
                                            <ItemStyle HorizontalAlign="Center" Width="10%" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblDocDate" runat="server" Text='<%# Bind("DocDate", "{0:dd/MM/yyyy}")%>' BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Due Date" SortExpression="DocDueDate">
                                            <ItemStyle HorizontalAlign="Center" Width="10%" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblDocDueDate" runat="server" Text='<%# Bind("DocDueDate", "{0:dd/MM/yyyy}")%>' BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="BP. Code" SortExpression="CardCode">
                                            <ItemStyle HorizontalAlign="Center"/>
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblCardCode" runat="server" Text='<%# Bind("CardCode") %>' BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="BP. Name" SortExpression="CardName">
                                            <ItemStyle HorizontalAlign="Left"/>
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblCardName" runat="server" Text='<%# Bind("CardName") %>' BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Remark" SortExpression="Comments">
                                            <ItemStyle HorizontalAlign="Left"/>
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblComments" runat="server" Text='<%# Bind("Comments") %>' BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Status" SortExpression="DocStatus">
                                            <ItemStyle HorizontalAlign="Center" Width="2%"/>
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblDocStatus" runat="server" Text='<%# Bind("DocStatus") %>' BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="Document Total">
                                            <ItemStyle HorizontalAlign="Right" />
                                            <HeaderStyle VerticalAlign="Middle" Width="15%" />
                                            <ItemTemplate>
                                                <asp:Label ID="txtDocTotal" runat="server" Text='<%#String.Format("{0,-15:#,##0.00}", Eval("DocTotal"))%>' BorderStyle="none" />
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="DocType" Visible="false">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblDocType" runat="server" BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                    </Columns>
                                    <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                                    <SelectedRowStyle  Font-Bold="true" ForeColor="Red" />
                                    <HeaderStyle BackColor="#6095C9" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False"
                                        Height="27px" VerticalAlign="Bottom" />
                                    <EmptyDataTemplate>
                                        No Data Found.
                                    </EmptyDataTemplate>
                                </asp:GridView>
                            </td>
                        </tr>
                    </table>
                </div>
                <div>
                    <table id="tblFooter" width="100%" style="font-weight: bold" >
                        <tr>
                            <td>
                                <asp:Timer ID="Timer1" runat="server" Interval="1" OnTick="Timer1_Tick" />
                                <asp:Button ID="btnAccept" runat="server" Text="OK" OnClick="btnAccept_Click" Style="background-image: url('/Images/bgButton.png');background-repeat: no-repeat;" Width="80px" />
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>


